package com.next

class BankAccount
{
    String numberOfAccount
    // 卡号
    String name
    //账号名
    String code
    //卡面代码
    String cellphone
    // 银行预留手机号
    ContactIdentityType certificateType
    //证件类型
    String numberOfCertificate
    //证件号
    Boolean active = true
    // 是否验卡成功
    String bankBranch
    // 支行
    String bankAddress
    // 运行地址
    String externalId
    Date createdDate = new Date()
    //记录创建时间
    Date modifiedDate = new Date()
    //记录修改时间
    Subject subject
    //验证码
    String verifiedCode

    Boolean circulationQuota
    //是否申请循环额度
    String postAddress
    //信用卡寄送地址
    String creditCardPaymentMethod
    // 信用卡还款方式
    String postAddressType
    //信用卡寄送地址类型

    Boolean isIssuingCardImmediately
    // 是否实时发卡
    String noAnnualFeeType
    // 免年费类别
    BankAccountType type
    // 卡片类别
    Boolean wannaToIncreaseQuota
    //是否有增额意愿
    Boolean connectmanIsClientManager
    //联系人是否是客户经理
    String creditCardPaymentType
    //信用卡还款类型
    String creditCardPaymentAccount
    // 还款账户选择
    String creditCardPayMethod
    // 刷卡消费方式选择
    String billSentMethod
    // 账单发送方式
    Province province
    City city

    BankAccountSubType subType
    //卡片子类型
    String address
    //开户行所在省市
    String houseProperty
    //住宅性质
    String priority
    //优先级
    String branchCode
    //分行网点号
    String marketerCode
    //营销人员代码
    String surnameOfMother
    // 母亲姓氏
    BankAccount parent

    String billSentEmail
    //账单寄送邮箱
    String marketingCampaignCode
    //营销活动代号
    String accountType
    //账户类别

    static belongsTo = [bank: Bank, paymentChannel: PaymentChannel, createdBy: User, modifiedBy: User]

    static constraints = {
        cellphone matches: /\d{11}/, nullable: true
        // certificateType nullable: 32, blank: true
        certificateType nullable: true, blank: true
        numberOfCertificate maxSize: 20, nullable: true
        numberOfAccount maxSize: 21
        name maxSize: 32
        name nullable: true, blank: true
        createdBy nullable: true, blank: true
        modifiedBy nullable: true, blank: true
        paymentChannel nullable: true, blank: true
        active nullable: true, blank: true
        bankBranch nullable: true, blank: true, maxSize: 256
        bankAddress nullable: true, blank: true, maxSize: 256
        externalId maxSize: 32, blank: true, nullable: true
        subject nullable: true, blank: true
        verifiedCode nullable: true, blank: true, maxSize: 6
        bank nullable: true, blank: true
        circulationQuota nullable: true, blank: true
        postAddress nullable: true, blank: true, maxSize: 256
        creditCardPaymentMethod blank: true, nullable: true, maxSize: 32, inList: ["主动还款", "自动还款"]
        postAddressType blank: true, nullable: true, maxSize: 32, inList: ["住宅地址", "单位地址"]

        code nullable: true, blank: true, maxSize: 32
        isIssuingCardImmediately nullable: true, blank: true
        noAnnualFeeType nullable: true, blank: true, maxSize: 32, inList: ["不免", "免除首年", "免除首张卡片周期年费", "终身免年费"]
        type nullable: true, blank: true
        wannaToIncreaseQuota nullable: true, blank: true
        connectmanIsClientManager nullable: true, blank: true
        creditCardPaymentType nullable: true, blank: true, maxSize: 32, inList: ["全额交付", "最低还款额"]
        creditCardPaymentAccount nullable: true, blank: true, maxSize: 128, inList: ["人民币与外币结欠分别以相应币种账号还款", "所有结欠均以人民币还款"]
        creditCardPayMethod nullable: true, blank: true, maxSize: 32, inList: ["密码+签名", "签名"]
        billSentMethod nullable: true, blank: true, maxSize: 32, inList: ["E-mail", "网银", "纸质", "手机"]
        province nullable: true, blank: true
        city nullable: true, blank: true

        subType nullable: true, blank: true
        address nullable: true, blank: true, maxSize: 64
        houseProperty nullable: true, blank: true, maxSize: 32
        priority nullable: true, blank: true, maxSize: 32
        branchCode nullable: true, blank: true, maxSize: 32
        marketerCode nullable: true, blank: true, maxSize: 32
        surnameOfMother nullable: true, blank: true, maxSize: 32
        parent nullable: true, blank: true
        billSentEmail nullable: true, blank: true, email: true
        marketingCampaignCode nullable: true, blank: true, maxSize: 32
        accountType nullable: true, blank: true, maxSize: 32, inList: ["个人结算账户", "公司结算账户"]
    }

    def beforeUpdate()
    {
        modifiedDate = new Date()
    }
}
